package example.上下左右;

// https://leetcode-cn.com/problems/ju-zhen-zhong-de-lu-jing-lcof/
public class Demo1 {
    //看来力扣不能让你有成员变量或者类变量--非要置0
    static int sum = 0;

    public static int uniquePaths(int m, int n) {
        sum = 0;
        if (n == 1 && m == 1) {
            return 1;
        }
        isTrue(1, 1, m, n);
        return sum;
    }

    public static boolean isTrue(int x, int y, int m, int n) {
        if (x == m && y == n) {
            return true;
        } else if (y > n || x > m) {
            return false;
        }
        boolean aTrue = isTrue(x + 1, y, m, n);
        boolean bTrue = isTrue(x, y + 1, m, n);
        if (aTrue) {
            sum++;
        }
        if (bTrue) {
            sum++;
        }
        return false;
    }

    public static void main(String[] args) {
        int i = uniquePaths(19, 13);
        System.out.println(i);
    }

}
